package until;

import org.apache.commons.lang3.StringUtils;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Description
 * @auther lileilei
 * @create 2020-01-28 18:39
 */
public class ParStrMap {
    public Map<String, Object> strtomap(String reslut) {
        Map<String, Object> map = new HashMap<>();
        String[] newone = (StringUtils.substringBeforeLast(StringUtils.substringAfter(reslut.split("intefaceDetailParamesVoList")[0], "{"), ",")).split(",");
        for (String s : newone) {
            map.put(s.split("=")[0], s.split("=")[1]);
        }
        String new_reslut = StringUtils.substringBeforeLast(reslut.split("intefaceDetailParamesVoList")[1].substring(1), "} }");
        map.put("parames", new_reslut);
        return map;
    }

    public static void main(String[] args) {
        ParStrMap parStrMap = new ParStrMap();
        String reslut = "{intefaceid=1, intefaceurl=/plan/logi, method=GET, asserts=sd, incodel=2323, unincloud=1dsd, logins=0, intefaceDetailParamesVoList=[{types=string, feilds=name, parames=name}]} }";

        System.out.println(parStrMap.strtomap(reslut).keySet());
    }
}
